﻿<?php 
	 session_start();
	 $_SESSION['valida'];
	 $user_log =  $_SESSION['valida'];
	 
	 mysql_connect('localhost','root','') or die (mysql_error());
	 mysql_select_db('chat') or die (mysql_error());
	
	$word = $_POST['s_post'];
	$result = mysql_query("SELECT * FROM usuario WHERE nome LIKE '%$word%' AND id <> '$user_log'");
	
	if(@mysql_num_rows($result) <= 0){
		echo '<p>Não foram encontrados resultados na sua pesquisa</p>';
	}else {
		echo '<ul>';
			while($res = mysql_fetch_object($result)){	
?>
<a href="#" nome="<?php echo $res->nome; ?>" id="<?php echo $res->id; ?>" class="comecar" style="text-decoration:none;">
    <li>
        <span><?php echo "<img style='float:left;margin-left:-5px;margin-top:-6px;width:30px;height:30px;' src='fotos/".$res->nome_final."'>" ?></span>
        <p><?php echo "&nbsp;".$res->nome; ?></p>
    </li>
</a>
<?php
			}	
	    echo '</ul>';
	}
?>